package com.mingye.board;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 棋盘加载器
 *
 * @author daixinyi
 */
public class BoardLoader {

    private static Map<String, Class> boardMap;

    static {
        boardMap = new LinkedHashMap<>();
        boardMap.put("第一关", Round1Board.class);
        boardMap.put("第二关", Round2Board.class);
        boardMap.put("第三关", Round3Board.class);
        boardMap.put("第四关", Round4Board.class);
        boardMap.put("第五关", Round5Board.class);
        boardMap.put("第六关", Round6Board.class);
        boardMap.put("第七关", Round7Board.class);
        boardMap.put("第八关", Round8Board.class);
        boardMap.put("第九关", Round9Board.class);
        boardMap.put("第十关", Round10Board.class);
        boardMap.put("第十一关", Round11Board.class);
        boardMap.put("第十二关", Round12Board.class);
        boardMap.put("第十三关", Round13Board.class);
    }

    /**
     * 获取所有的关卡名
     *
     * @return
     */
    public static List<String> getBoardKeys() {
        List<String> keys = new ArrayList<>();
        for (Map.Entry<String, Class> entry : boardMap.entrySet()) {
            keys.add(entry.getKey());
        }
        return keys;
    }

    /**
     * 获取所有的关卡（值）
     *
     * @param key
     * @return
     */
    public static Class getValueByKey(String key) {
        if (boardMap.containsKey(key)) {
            return boardMap.get(key);
        }
        return null;
    }
}
